//
//  QPColor.swift
//  QianPingNew
//
//  Created by Apple on 2019/5/14.
//  Copyright © 2019 Apple. All rights reserved.
//

import UIKit
import SwifterSwift

/// 颜色
///
/// - Parameters:
///   - red: r
///   - green: g
///   - blue: b
///   - alpha: a
/// - Returns: 颜色
func rgba(_ red: CGFloat, _ green: CGFloat,  _ blue: CGFloat,  _ alpha: CGFloat) -> UIColor {
    return UIColor(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: alpha)
}

/// 颜色
///
/// - Parameters:
///   - red: r
///   - green: g
///   - blue: b
/// - Returns: 颜色
func rgb(_ red: CGFloat, _ green: CGFloat,  _ blue: CGFloat) -> UIColor {
    return rgba(red, green, blue, 1.0)
}

/// 随机色
///
/// - Returns: 返回随机色
func randomColor() -> UIColor {

    let red = CGFloat(arc4random()%256)/255.0
    let green = CGFloat(arc4random()%256)/255.0
    let blue = CGFloat(arc4random()%256)/255.0
    return UIColor(red: red, green: green, blue: blue, alpha: 1.0)    
}

extension UIColor {
    //返回随机颜色
    class var randomColor: UIColor {
        get {
            let red = CGFloat(arc4random()%256)/255.0
            let green = CGFloat(arc4random()%256)/255.0
            let blue = CGFloat(arc4random()%256)/255.0
            return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
        }
    }
}


extension Color {

    struct Theme {

        
    }
    static let textColor = Color(hexString: "#333333")
    
    static let themeBlack = Color(hexString: "#101010")
    
    static let lightGrayColor = Color(hexString: "#cccccc")
    
    static let b3GrayColor = Color(hexString: "#b3b3b3")
    
    static let dbGrayColor = Color(hexString: "#dbdbdb")
    
    static let faGrayColor = Color(hexString: "#fafafa")
    
    static let e6GrayColor = Color(hexString: "#e6e6e6")
    
    static let themeColor = rgba(255, 18, 21, 1)
    static let themeYellow = rgba(255, 185, 74, 1)
}
